﻿using DotNetCore.CAP;
using MediatR;
using Microsoft.EntityFrameworkCore;
using MyTask.Infrastructure.Core;
using MyTask.Tasking.Domain.TaskAggregate;
using MyTask.Tasking.Infrastructure.EntityConfigurations;
using System;
using System.Collections.Generic;
using System.Text;

namespace MyTask.Tasking.Infrastructure
{
    public class TaskingContext : EFContext
    {
        public TaskingContext(DbContextOptions options, IMediator mediator, ICapPublisher capBus) : base(options, mediator, capBus)
        {
        }
         public DbSet<UserInfo> UserInfos { get; set; }
         public DbSet<TaskInfo> TaskInfos { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            #region 注册领域模型与数据库的映射关系
            modelBuilder.ApplyConfiguration(new UserInfoEntityTypeConfiguration());
            modelBuilder.ApplyConfiguration(new TaskInfoEntityTypeConfiguration());
            #endregion
            base.OnModelCreating(modelBuilder);
        }

    }
}
